Now you will learn how to graph average current in the model, just as instantaneous current is. The code below shows how instantaneous current was plotted in the model.

set-current-plot-pen provides a label for the graph and tells the model to start plotting something
plotxy ticks tells the model what to plot every tick (or time point)
current-now-list is a list that contains values representing how many charges are passing through this section of the wire at every tick for the past n ticks where n is the sampling rate in the slider
sum adds up all the values in a list
length finds the length of a list. For current-now-list, this will always be the sampling rate
Now, open the code tab of the model. To do this:
1) Scroll down in the model on the left and you will see three tabs "Command Center", "NetLogo Code", and "Model Info".
2) Click "NetLogo Code" to open the code tab.
You can find the plotting code from above if you scroll down in the code tab to lines 378 and 379. Look in the code tab and find current-now-list. This shows how the current now (stored in current-now-list) is plotted in the graph within the model.
If you want to see how current-now-list look at lines 204 and 205 which contain code that states if the length of the list is greater than the sampling-rate (that is set by you with the slider), the first item of the list is removed. So, if you set your sampling rate to 50, then my-charge-list shows how many charges pass through this sections of the wire for the most recent 50 ticks. You can see in lines 201 and 202 how the code adds the current at each tick to lists.
With the model below, there is another list introduced called average-current-list which also shows how many charges are passing through this section of the wire at every tick like current-now-list, but average-current-list does not remove items when the length of the list surpasses the sampling rate. This means all values remain in the list and none are ever removed.
Explore the model and look at the code tab to examine this.